using UnityEngine;
using UnityActionSystem;

namespace ZYFramework.AudioSystem
{
    /// <summary>
    /// 播放2D音效事件数据
    /// </summary>
    public class PlaySFXEventData : EventDataBase
    {
        /// <summary>
        /// 音效名称
        /// </summary>
        public string AudioName { get; set; }

        /// <summary>
        /// 播放参数（可选）
        /// </summary>
        public AudioPlayParams? Params { get; set; }

        public PlaySFXEventData() : base()
        {
        }

        public PlaySFXEventData(string audioName, AudioPlayParams? @params = null) : base()
        {
            AudioName = audioName;
            Params = @params;
        }
    }

    /// <summary>
    /// 播放3D音效事件数据
    /// </summary>
    public class Play3DSFXEventData : EventDataBase
    {
        /// <summary>
        /// 音效名称
        /// </summary>
        public string AudioName { get; set; }

        /// <summary>
        /// 绑定的Transform（3D位置）
        /// </summary>
        public Transform BindTransform { get; set; }

        /// <summary>
        /// 播放参数（可选）
        /// </summary>
        public AudioPlayParams? Params { get; set; }

        public Play3DSFXEventData() : base()
        {
        }

        public Play3DSFXEventData(string audioName, Transform bindTransform, AudioPlayParams? @params = null) : base()
        {
            AudioName = audioName;
            BindTransform = bindTransform;
            Params = @params;
        }
    }

    /// <summary>
    /// 播放BGM事件数据
    /// </summary>
    public class PlayBGMEventData : EventDataBase
    {
        /// <summary>
        /// BGM名称
        /// </summary>
        public string AudioName { get; set; }

        /// <summary>
        /// 播放参数（可选）
        /// </summary>
        public AudioPlayParams? Params { get; set; }

        public PlayBGMEventData() : base()
        {
        }

        public PlayBGMEventData(string audioName, AudioPlayParams? @params = null) : base()
        {
            AudioName = audioName;
            Params = @params;
        }
    }

    /// <summary>
    /// 停止音效事件数据
    /// </summary>
    public class StopAudioEventData : EventDataBase
    {
        /// <summary>
        /// 音效名称
        /// </summary>
        public string AudioName { get; set; }

        /// <summary>
        /// 音频类型
        /// </summary>
        public AudioType AudioType { get; set; }

        public StopAudioEventData() : base()
        {
        }

        public StopAudioEventData(string audioName, AudioType audioType) : base()
        {
            AudioName = audioName;
            AudioType = audioType;
        }
    }

    /// <summary>
    /// 停止所有音效事件数据
    /// </summary>
    public class StopAllAudioEventData : EventDataBase
    {
        /// <summary>
        /// 音频类型（null表示停止所有类型）
        /// </summary>
        public AudioType? AudioType { get; set; }

        public StopAllAudioEventData() : base()
        {
        }

        public StopAllAudioEventData(AudioType? audioType = null) : base()
        {
            AudioType = audioType;
        }
    }

    /// <summary>
    /// 设置全局音量事件数据
    /// </summary>
    public class SetGlobalVolumeEventData : EventDataBase
    {
        /// <summary>
        /// 音频类型
        /// </summary>
        public AudioType AudioType { get; set; }

        /// <summary>
        /// 音量值（0-1）
        /// </summary>
        public float Volume { get; set; }

        public SetGlobalVolumeEventData() : base()
        {
        }

        public SetGlobalVolumeEventData(AudioType audioType, float volume) : base()
        {
            AudioType = audioType;
            Volume = volume;
        }
    }

    /// <summary>
    /// 静音/取消静音事件数据
    /// </summary>
    public class MuteAudioEventData : EventDataBase
    {
        /// <summary>
        /// 音频类型
        /// </summary>
        public AudioType AudioType { get; set; }

        /// <summary>
        /// 是否静音
        /// </summary>
        public bool IsMute { get; set; }

        public MuteAudioEventData() : base()
        {
        }

        public MuteAudioEventData(AudioType audioType, bool isMute) : base()
        {
            AudioType = audioType;
            IsMute = isMute;
        }
    }
}
